const mysql = require("mysql");
const { dbConfig } = require("../../config/config");
const { logger } = require("../middleware/logger");

const db = mysql.createPool({
  host: dbConfig.mysql.host,
  user: dbConfig.mysql.user,
  password: dbConfig.mysql.password,
  database: dbConfig.mysql.database
});

// db.query("select 1", (err, results) => {
//   if(err) return logger("数据库连接异常！");
//   logger("数据库连接成功！")
// })

module.exports = db;
